package com.yang.controller;

import com.yang.model.Pet;
import com.yang.service.PetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pet")
@Slf4j
public class PetController {

    @Resource
    private PetService petService;

    @GetMapping("/get/{ownerId}")
    public Pet queryPetByUserId(@PathVariable String ownerId) {
        Pet pet = petService.queryPetByUserId(ownerId);
        return pet;
    }

    @PostMapping("/update")
    public Pet updatePetByPetId(String id, String speed, String attack, String defence) {
        Pet pet = petService.updatePetByPetId(id, speed, attack, defence);
        return pet;
    }
}
